package id.net.iconpln.bb.client.view;

import id.net.iconpln.bb.client.data.TestData;
import id.net.iconpln.bb.client.model.BbEntryJadwalBean;
import id.net.iconpln.bb.client.model.BeanModelPerencanaanBb;
import id.net.iconpln.bb.client.model.BbMasterPemasokBean;
import id.net.iconpln.bb.client.model.BbMstPembangkitBean;
import id.net.iconpln.bb.client.model.BbMstSurveyorBean;
import id.net.iconpln.bb.client.model.BeanModelMasterBb;
import id.net.iconpln.bb.client.service.BatubaraService;
import id.net.iconpln.bb.client.service.BatubaraServiceAsync;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.Orientation;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.binding.FormBinding;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.util.IconHelper;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.CellSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
import com.extjs.gxt.ui.client.widget.layout.FitData;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import com.extjs.gxt.ui.client.widget.layout.RowData;
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
import com.extjs.gxt.ui.client.widget.toolbar.LabelToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class PageBbMasterSurveyor extends LayoutContainer {
	private final BatubaraServiceAsync rkapService = GWT.create(BatubaraService.class);
	Grid<BeanModelMasterBb> grid;
	Grid<BeanModelMasterBb> gridVirtualPembangkit;
	Grid<BeanModelMasterBb> gridVirtualPemasok;
	EditorGrid<BeanModelMasterBb> gridpasokan;
	Grid<BeanModelMasterBb> grid1;
	private List<BeanModelMasterBb> datakit;
	ListStore<BeanModelMasterBb> store1;
	ListStore<BeanModelMasterBb> storeVirtualPembangkit;
	ListStore<BeanModelMasterBb> storeVirtualPemasok;
	private List<BeanModelMasterBb> datapemasok;
	ListStore<BeanModelMasterBb> store2;
	ListStore<BeanModelMasterBb> store3;
	private List<BeanModelMasterBb> datasurveyor;
	private FormData formData;
	private FormBinding formBindings;
	ToolBar toolbar = new ToolBar();
	ToolBar toolbar1 = new ToolBar();
	ToolBar toolbar2 = new ToolBar();
	 List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
	 ColumnConfig 	id_pemasok	 = new ColumnConfig();
	 ColumnConfig 	pemasok	 = new ColumnConfig();
	 ColumnConfig 	alamat	 = new ColumnConfig();
	 ColumnConfig 	pic_presdir	 = new ColumnConfig();
	 ColumnConfig 	pic_presdir_hp	 = new ColumnConfig();
	 ColumnConfig 	pic_dir_marketing	 = new ColumnConfig();
	 ColumnConfig 	pic_dir_marketing_hp	 = new ColumnConfig();
	 ColumnConfig 	pic_man_opr	 = new ColumnConfig();
	 ColumnConfig 	pic_man_opr_hp	 = new ColumnConfig();
	 ColumnConfig 	status_pemasok	 = new ColumnConfig();
	 ColumnConfig 	nama_tambang	 = new ColumnConfig();
	 ColumnConfig 	produksi	 = new ColumnConfig();
	 ColumnConfig 	loading_port	 = new ColumnConfig();
	 ColumnConfig 	fasilitas_loading	 = new ColumnConfig();
	 ColumnConfig 	jarak_hauling	 = new ColumnConfig();
	 ColumnConfig 	flag_blacklist	 = new ColumnConfig();
	 ColumnConfig 	status_aktif	 = new ColumnConfig();
	 ColumnConfig 	keterangan	 = new ColumnConfig();
	 ColumnConfig 	createby	 = new ColumnConfig();
	 ColumnConfig 	createdate	 = new ColumnConfig();
	 ColumnConfig 	updateby	 = new ColumnConfig();
	 ColumnConfig 	updatedate	 = new ColumnConfig();
	 ColumnConfig 	app_access	 = new ColumnConfig();
     Button btinsert;
     Button btupdate;
     Button btdelete;
     Button btcetak;
     BbMstSurveyorBean plant = new BbMstSurveyorBean();
     ListStore<BbMstSurveyorBean> store = new ListStore<BbMstSurveyorBean>();
     public Window window;
     private BeanModelMasterBb veyorbean = new BeanModelMasterBb();
	
	@Override
	  protected void onRender(Element parent, int pos) {
	    super.onRender(parent, pos); 
	    setLayout(new FitLayout());  
	    DateTimeFormat dt = DateTimeFormat.getFormat("dd/MM/YYYY");
	    formData = new FormData("-20");
	    ContentPanel cp = new ContentPanel();  
	    cp.setHeading("Surveyor");  
	    cp.setFrame(true);  
	    cp.setSize(1030, 600);  
	    cp.setLayout(new RowLayout(Orientation.HORIZONTAL));  
	  
	    grid1 = createGrid1();
	    grid = createGrid();
	    gridpasokan = createGridjadwal();
	  
	    
	    ContentPanel pan = new ContentPanel();
	    pan.setHeaderVisible(false);
	    pan.setLayout(new FitLayout());
	    pan.add(grid1);
	    toolbar1.add(new LabelToolItem("Daftar Pemasok"));
	    toolbar1.add(new SeparatorToolItem());
	    pan.setTopComponent(toolbar1);
	    
	    ContentPanel pan1 = new ContentPanel();
	    pan1.setHeaderVisible(false);
	    pan1.setLayout(new FitLayout());
	    pan1.add(grid);
	    toolbar2.add(new LabelToolItem("Daftar Pembangkit"));
	    toolbar2.add(new SeparatorToolItem());
	    pan1.setTopComponent(toolbar2);
	    
	    ContentPanel panel = new ContentPanel();
	    panel.setHeaderVisible(false);
	    panel.setLayout(new RowLayout(Orientation.VERTICAL));
	    panel.add(pan, new RowData(1, .5));
	    panel.add(pan1, new RowData(1, .5));
	    
	    Button bt = new Button("New");  
	    bt.addSelectionListener(new SelectionListener<ButtonEvent>() {  
	  
	      @Override  
	      public void componentSelected(ButtonEvent ce) {  

	    	  	FormPanel simple = new FormPanel();  
			    simple.setHeaderVisible(false);
			    simple.setFrame(true);  
			    simple.setWidth(380);
			    
			    FieldSet fieldSet = new FieldSet();  
			    fieldSet.setHeading("Identitas Transportir");  
			    fieldSet.setCollapsible(false);
			    
			    FormLayout layout = new FormLayout();  
			    layout.setLabelWidth(120);  
			    fieldSet.setLayout(layout);
			  
			    final TextField<String> txtnmveyor = new TextField<String>(); 
			    txtnmveyor.setFieldLabel("Nama Surveyor"); 
			    txtnmveyor.setMaxLength(100);
			    fieldSet.add(txtnmveyor);
			    
			    final TextField<String> txtnokerjasama = new TextField<String>(); 
			    txtnokerjasama.setFieldLabel("No Kerja Sama"); 
			    txtnokerjasama.setMaxLength(100);
			    fieldSet.add(txtnokerjasama);
			    
			    final TextField<String> txtnokontrak = new TextField<String>(); 
			    txtnokontrak.setFieldLabel("No Kontrak PLN PJBB"); 
			    txtnokontrak.setMaxLength(100);
			    fieldSet.add(txtnokontrak);
			    
			    final DateTimeFormat dtFormat = DateTimeFormat.getFormat("dd/MM/yyyy");
				final DateField txttgl=new DateField();
				txttgl.getPropertyEditor().setFormat(dtFormat);
			    txttgl.setFieldLabel("Tanggal"); 
			    fieldSet.add(txttgl);
			    
			    final TextField<String> txttlp = new TextField<String>(); 
			    txttlp.setFieldLabel("Telp"); 
			    txttlp.setMaxLength(100);
			    fieldSet.add(txttlp);
			    
			    final TextField<String> txtalamat = new TextField<String>(); 
			    txtalamat.setFieldLabel("Alamat"); 
			    txtalamat.setMaxLength(100);
			    fieldSet.add(txtalamat);
			    
			    final TextField<String> txtpic = new TextField<String>(); 
			    txtpic.setFieldLabel("PIC"); 
			    txtpic.setMaxLength(100);
			    fieldSet.add(txtpic);
			    
			    final TextField<String> txtket = new TextField<String>(); 
			    txtket.setFieldLabel("Keterangan"); 
			    txtket.setMaxLength(100);
			    fieldSet.add(txtket);
			    
			    simple.add(fieldSet);
			    
			    
			    simple.setButtonAlign(HorizontalAlignment.LEFT);  
			    simple.addButton(new Button("Cancel", new SelectionListener<ButtonEvent>() {  
			      @Override  
			      public void componentSelected(ButtonEvent ce) {  
			        grid.getStore().rejectChanges(); 
			        window.close();
			      }  
			    }));  
			    simple.addButton(new Button("Save", new SelectionListener<ButtonEvent>() {  
			      @Override  
			      public void componentSelected(ButtonEvent ce) {
			    	String session = Registry.get("isModule"); 
			    	
			    	BeanModelMasterBb aa = new BeanModelMasterBb();
//			    	aa.setId_surveyor(id_surveyor);
			    	aa.setNama_surveyor(txtnmveyor.getValue());
			    	aa.setNo_kerjasama(txtnokerjasama.getValue());
			    	System.out.println("tgl di ui: " + txttgl.getRawValue());
			    	aa.setTanggal(txttgl.getRawValue());
			    	aa.setTelp(txttlp.getValue());
			    	aa.setAlamat(txtalamat.getValue());
			    	aa.setPic(txtpic.getValue());
			    	aa.setKeterangan(txtket.getValue());
			    	aa.setNo_kontrak(txtnokontrak.getValue());
			    	aa.setCreateby(session);
			        aa.setApp_access("WEB App");
			    	
			    	
			  	  	rkapService.insertMasterBB(aa,"SURVEYOR","CREATE", new AsyncCallback<List<BeanModelMasterBb>>() {
						public void onFailure(Throwable caught) {
							GWT.log(caught.getMessage(), null);
						}

						public void onSuccess(List<BeanModelMasterBb> result) {
							gridpasokan.mask("load Data ....","x-mask-loading");
					    	  store3.removeAll();
					    	  getdataSurveyor();
							
						}
					});
			        grid.getStore().commitChanges();
			        Info.display("Notifikasi: ", "Data Berhasil Di simpan");
			        window.close();
			      }  
			    }));  
			    
			    simple.setButtonAlign(HorizontalAlignment.CENTER); 
			    
			    formBindings = new FormBinding(simple, true); 
			    formBindings.setStore(store);
			    
			    Button btdalamCp = new Button("New", new SelectionListener<ButtonEvent>() {  
				      @Override  
				      public void componentSelected(ButtonEvent ce) {
				    	  
				    	gridVirtualPemasok = createGridVirtualPemasok();
				    	gridVirtualPembangkit = createGridVirtualPembangkit();  
				    	  
				    	ContentPanel pan = new ContentPanel();
				  	    pan.setHeaderVisible(false);
				  	    pan.setLayout(new FitLayout());
				  	    pan.add(gridVirtualPemasok);
				  	    pan.setScrollMode(Scroll.AUTO);
				  	    
				  	    ContentPanel pan1 = new ContentPanel();
				  	    pan1.setHeaderVisible(false);
				  	    pan1.setLayout(new FitLayout());
				  	    pan1.add(gridVirtualPembangkit);
				  	    pan1.setScrollMode(Scroll.AUTO);
				    	  
				  	    ContentPanel delimeter = new ContentPanel();
					    delimeter.setHeaderVisible(false);
					    delimeter.setWidth(10);
				  	    
				    	ContentPanel panel = new ContentPanel();
				  	    panel.setHeaderVisible(false);
				  	    panel.setLayout(new RowLayout(Orientation.HORIZONTAL));
				  	    panel.add(pan, new RowData(.5, 1));
				  	    panel.add(delimeter, new FitData(5));
				  	    panel.add(pan1, new RowData(.5, 1));
				    	  
				  	    
				  	  	window = new Window();  
					    window.setHeading("Daftar Pemasok - Pembangkit"); 
					    window.setLayout(new FitLayout());
//					    window.setAutoHeight(true);
					    window.setWidth(1000);
					    window.setHeight(500);
//					    window.setAutoWidth(true);
					    window.setScrollMode(Scroll.AUTO);
					    window.add(panel);
					    
					    window.show();  	
				      }  
				    });  
			    btdalamCp.setIcon(IconHelper.createStyle("icon-contact-add"));
			    
			    
			    ContentPanel cp = new ContentPanel();
			    
			    cp.setHeaderVisible(false);
			    ToolBar toolbar1 = new ToolBar();  
			    toolbar1.add(btdalamCp);
			    cp.setTopComponent(toolbar1);
			    cp.add(simple);
			    
			    window = new Window();  
			    window.setHeading("New Master Surveyor");
//			    window.setLayout(new FitLayout());
			    window.setAutoHeight(true);
			    window.setAutoWidth(true);
			    window.add(cp);
			    
	        	window.show();
	      }  
	  
	    });
	    bt.setIcon(IconHelper.createStyle("icon-contact-add"));

	    
	    Button btload = new Button("Load", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {
		    	  gridpasokan.mask("load Data ....","x-mask-loading");
		    	  store3.removeAll();
		    	  getdataSurveyor();
		      }  
		    });  
		    
	    btload.setIcon(IconHelper.createStyle("icon-reza-refresh"));
	    
	    btinsert = new Button("Simpan", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {
		    	 
		      }  
		    });  
		    
      btinsert.setIcon(IconHelper.createStyle("icon-reza-add"));
      
      btupdate = new Button("Ubah", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {
		    	  	
		    	  	FormPanel simple = new FormPanel();  
				    simple.setHeaderVisible(false);
				    simple.setFrame(true);  
				    simple.setWidth(380);
				    
				    FieldSet fieldSet = new FieldSet();  
				    fieldSet.setHeading("Identitas Transportir");  
				    fieldSet.setCollapsible(false);
				    
				    FormLayout layout = new FormLayout();  
				    layout.setLabelWidth(120);  
				    fieldSet.setLayout(layout);
				  
				    final TextField<String> txtnmveyor = new TextField<String>(); 
				    txtnmveyor.setFieldLabel("Nama Surveyor");
				    txtnmveyor.setValue(veyorbean.getNama_surveyor());
				    txtnmveyor.setMaxLength(100);
				    fieldSet.add(txtnmveyor);
				    
				    final TextField<String> txtnokerjasama = new TextField<String>(); 
				    txtnokerjasama.setFieldLabel("No Kerja Sama");
				    txtnokerjasama.setValue(veyorbean.getNo_kerjasama());
				    txtnokerjasama.setMaxLength(100);
				    fieldSet.add(txtnokerjasama);
				    
				    final TextField<String> txtnokontrak = new TextField<String>(); 
				    txtnokontrak.setFieldLabel("No Kontrak PLN PJBB");
				    txtnokontrak.setValue(veyorbean.getNo_kontrak());
				    txtnokontrak.setMaxLength(100);
				    fieldSet.add(txtnokontrak);
				    
				    
				    final DateTimeFormat dtFormat = DateTimeFormat.getFormat("dd/MM/yyyy");
					final DateField txttgl=new DateField();
					txttgl.getPropertyEditor().setFormat(dtFormat);
				    txttgl.setFieldLabel("Tanggal"); 
				    Date tgl = dtFormat.parse(veyorbean.getTanggal());
				    txttgl.setValue(tgl);
				    fieldSet.add(txttgl);
				    
				    final TextField<String> txttlp = new TextField<String>(); 
				    txttlp.setFieldLabel("Telp"); 
				    txttlp.setValue(veyorbean.getTelp());
				    fieldSet.add(txttlp);
				    
				    final TextField<String> txtalamat = new TextField<String>(); 
				    txtalamat.setFieldLabel("Alamat"); 
				    txtalamat.setValue(veyorbean.getAlamat());
				    txtalamat.setMaxLength(100);
				    fieldSet.add(txtalamat);
				    
				    final TextField<String> txtpic = new TextField<String>(); 
				    txtpic.setFieldLabel("PIC"); 
				    txtpic.setValue(veyorbean.getPic());
				    txttgl.setAllowBlank(false);
				    txtpic.setMaxLength(100);
				    fieldSet.add(txtpic);
				    
				    final TextField<String> txtket = new TextField<String>(); 
				    txtket.setFieldLabel("Keterangan");
				    txtket.setValue(veyorbean.getKeterangan());
				    txtket.setMaxLength(100);
				    fieldSet.add(txtket);
				    
				    simple.add(fieldSet);
				    
				    simple.setButtonAlign(HorizontalAlignment.LEFT);  
				    simple.addButton(new Button("Cancel", new SelectionListener<ButtonEvent>() {  
				      @Override  
				      public void componentSelected(ButtonEvent ce) {  
				        grid.getStore().rejectChanges(); 
				        window.close();
				      }  
				    }));  
				    simple.addButton(new Button("Update", new SelectionListener<ButtonEvent>() {  
				      @Override  
				      public void componentSelected(ButtonEvent ce) {
				    	String session = Registry.get("isModule");  	
				    	BeanModelMasterBb aa = new BeanModelMasterBb();
				    	aa.setId_surveyor(veyorbean.getId_surveyor());
				    	aa.setNama_surveyor(txtnmveyor.getValue());
				    	aa.setNo_kerjasama(txtnokerjasama.getValue());
				    	aa.setTanggal(txttgl.getValue().toString());
				    	aa.setTelp(txttlp.getValue());
				    	aa.setAlamat(txtalamat.getValue());
				    	aa.setPic(txtpic.getValue());
				    	aa.setKeterangan(txtket.getValue());
				    	aa.setNo_kontrak(txtnokontrak.getValue());
				        aa.setUpdateby(session);
				        aa.setApp_access("WEB App");
				    	
				    	
				  	  	rkapService.insertMasterBB(aa,"SURVEYOR","UPDATE", new AsyncCallback<List<BeanModelMasterBb>>() {
							public void onFailure(Throwable caught) {
								GWT.log(caught.getMessage(), null);
							}

							public void onSuccess(List<BeanModelMasterBb> result) {
								gridpasokan.mask("load Data ....","x-mask-loading");
						    	  store3.removeAll();
						    	  getdataSurveyor();
								
							}
						});
				        grid.getStore().commitChanges();
				        Info.display("Notifikasi: ", "Data Berhasil Di Ubah");
				        window.close();
				      }  
				    }));  
				    
				    simple.setButtonAlign(HorizontalAlignment.CENTER); 
				    
				    formBindings = new FormBinding(simple, true); 
				    formBindings.setStore(store);
				    
				    Button btdalamCp = new Button("New", new SelectionListener<ButtonEvent>() {  
					      @Override  
					      public void componentSelected(ButtonEvent ce) {
					    	  
					    	gridVirtualPemasok = createGridVirtualPemasok();
					    	gridVirtualPembangkit = createGridVirtualPembangkit();  
					    	  
					    	ContentPanel pan = new ContentPanel();
					  	    pan.setHeaderVisible(false);
					  	    pan.setLayout(new FitLayout());
					  	    pan.add(gridVirtualPemasok);
					  	    pan.setScrollMode(Scroll.AUTO);
					  	    ToolBar toolbar1 = new ToolBar();
					  	    toolbar1.add(new LabelToolItem("Daftar Pemasok"));
						    toolbar1.add(new SeparatorToolItem());
						    pan.setTopComponent(toolbar1);
					  	    
					  	    ContentPanel pan1 = new ContentPanel();
					  	    pan1.setHeaderVisible(false);
					  	    pan1.setLayout(new FitLayout());
					  	    pan1.add(gridVirtualPembangkit);
					  	    pan1.setScrollMode(Scroll.AUTO);
					  	    ToolBar toolbar2 = new ToolBar();
					  	    toolbar2.add(new LabelToolItem("Daftar Pembangkit"));
					  	    toolbar2.add(new SeparatorToolItem());
						    pan1.setTopComponent(toolbar2);
					    	  
					  	    ContentPanel delimeter = new ContentPanel();
						    delimeter.setHeaderVisible(false);
						    delimeter.setWidth(10);
					  	    
					    	ContentPanel panel = new ContentPanel();
					  	    panel.setHeaderVisible(false);
					  	    panel.setLayout(new RowLayout(Orientation.HORIZONTAL));
					  	    panel.add(pan, new RowData(.5, 1));
					  	    panel.add(delimeter, new FitData(5));
					  	    panel.add(pan1, new RowData(.5, 1));
					    	  
					  	    
					  	  	window = new Window();  
						    window.setHeading("Daftar Pemasok - Pembangkit"); 
						    window.setLayout(new FitLayout());
//						    window.setAutoHeight(true);
						    window.setWidth(1000);
						    window.setHeight(500);
//						    window.setAutoWidth(true);
						    window.setScrollMode(Scroll.AUTO);
						    window.add(panel);
						    
						    window.show();  	
					      }  
					    });  
				    btdalamCp.setIcon(IconHelper.createStyle("icon-contact-add"));
				    
				    
				    ContentPanel cp = new ContentPanel();
				    
				    cp.setHeaderVisible(false);
				    ToolBar toolbar1 = new ToolBar();  
				    toolbar1.add(btdalamCp);
				    cp.setTopComponent(toolbar1);
				    cp.add(simple);
				    
				    window = new Window();  
				    window.setHeading("New Master Surveyor");
//				    window.setLayout(new FitLayout());
				    window.setAutoHeight(true);
				    window.setAutoWidth(true);
				    window.add(cp);
				    
		        	window.show();
		      }  
		    });  
	   btupdate.setIcon(IconHelper.createStyle("icon-reza-edit"));
	   
	   btdelete = new Button("Delete", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {
		    	  BeanModelMasterBb aa = new BeanModelMasterBb();
			    	aa.setId_surveyor(veyorbean.getId_surveyor());
			    	
			    	
			  	  	rkapService.insertMasterBB(aa,"SURVEYOR","DELETE", new AsyncCallback<List<BeanModelMasterBb>>() {
						public void onFailure(Throwable caught) {
							GWT.log(caught.getMessage(), null);
						}

						public void onSuccess(List<BeanModelMasterBb> result) {
							gridpasokan.mask("load Data ....","x-mask-loading");
					    	  store3.removeAll();
					    	  getdataSurveyor();
							
						}
					});
			        grid.getStore().commitChanges();
			        Info.display("Notifikasi: ", "Data Berhasil Di Delete");
			        window.close();
		      }  
		    });  
	   btdelete.setIcon(IconHelper.createStyle("icon-reza-delete"));
	   
	   btcetak = new Button("Cetak", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {
		    	  
		      }  
		    });  
	    btcetak.setIcon(IconHelper.createStyle("icon-printer"));
	    
	    ContentPanel cppasokan = new ContentPanel();
	    cppasokan.setHeaderVisible(false);
	    cppasokan.add(gridpasokan);
	    cppasokan.setLayout(new FitLayout());
	    toolbar.add(new LabelToolItem("Daftar Surveyor"));
//	    toolbar.add(new SeparatorToolItem());
//	    toolbar.add(btload);
	    toolbar.add(new SeparatorToolItem());
	    toolbar.add(bt);
		toolbar.add(new SeparatorToolItem());
	    toolbar.add(btupdate);
		toolbar.add(new SeparatorToolItem()); 
		toolbar.add(btdelete);
//		toolbar.add(new SeparatorToolItem()); 
//		toolbar.add(btcetak);
	    cppasokan.setTopComponent(toolbar);
	    
	    ContentPanel delimeter = new ContentPanel();
	    delimeter.setHeaderVisible(false);
	    delimeter.setWidth(10);
	    
	    cp.add(panel, new RowData(.4, 1));  
	    cp.add(delimeter, new FitData(5));
	    cp.add(cppasokan, new RowData(.6, 1));
	    add(cp, new FitData(5)); 
	  }  
	  
	private EditorGrid<BeanModelMasterBb> createGridjadwal() {  
	    
		   
		final List<ColumnConfig> columns = new ArrayList<ColumnConfig>(); 
	    
		store3 = new ListStore<BeanModelMasterBb>();
		getdataSurveyor();
		
		RowNumberer id = new RowNumberer();  
	    id.setWidth(30);
	    
	    ColumnConfig idsvr = new ColumnConfig("id_surveyor", "ID Surveyor", 120);
	    idsvr.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig nmsvr = new ColumnConfig("nama_surveyor", "Nama Surveyor", 250);
	    nmsvr.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig nokerjasama = new ColumnConfig("no_kerjasama", "No Kerja Sama", 100);
	    nokerjasama.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig tgl = new ColumnConfig("tanggal", "Tanggal", 100);
	    tgl.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig tlp = new ColumnConfig("telp", "Telp", 130);
	    tlp.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig alamat = new ColumnConfig("alamat", "Alamat", 130);
	    alamat.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig pic = new ColumnConfig("pic", "PIC", 130);
	    pic.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig ket = new ColumnConfig("keterangan", "Keterangan", 130);
	    ket.setAlignment(HorizontalAlignment.LEFT);
	    
	    ColumnConfig nokontrak = new ColumnConfig("no_kontrak", "No Kontrak", 130);
	    nokontrak.setAlignment(HorizontalAlignment.LEFT);
	    
	    columns.add(id);
	    columns.add(nmsvr);
	    columns.add(nokontrak);
	    columns.add(nokerjasama);
	    columns.add(tgl);
	    columns.add(alamat);
	    columns.add(pic);
	    columns.add(ket); 
	    
		    final ColumnModel cm = new ColumnModel(columns);
		    
		    gridpasokan = new EditorGrid<BeanModelMasterBb>(store3, cm);
		    
		    final CellSelectionModel<BeanModelMasterBb> csm = new CellSelectionModel<BeanModelMasterBb>();
		    gridpasokan.setSelectionModel(csm);
		    gridpasokan.addListener(Events.CellClick, new Listener<BaseEvent>() {            
	            public void handleEvent(BaseEvent ge) {
	            	
	            	String id_surveyor = csm.getSelectCell().model.getId_surveyor(); 
	            	String nama_surveyor = csm.getSelectCell().model.getNama_surveyor();
	            	String no_kerjasama = csm.getSelectCell().model.getNo_kerjasama();
	            	String tanggal = csm.getSelectCell().model.getTanggal();
	            	String telp = csm.getSelectCell().model.getTelp();
	            	String alamat = csm.getSelectCell().model.getAlamat();
	            	String pic = csm.getSelectCell().model.getPic();
	            	String keterangan = csm.getSelectCell().model.getKeterangan(); 
	            	String no_kontrak = csm.getSelectCell().model.getNo_kontrak();
	            	
	            	veyorbean.setId_surveyor(id_surveyor);
	            	veyorbean.setNama_surveyor(nama_surveyor);
	            	veyorbean.setNo_kerjasama(no_kerjasama);
	            	veyorbean.setTanggal(tanggal);
	            	veyorbean.setTelp(telp);
	            	veyorbean.setAlamat(alamat);
	            	veyorbean.setPic(pic);
	            	veyorbean.setKeterangan(keterangan);
	            	veyorbean.setNo_kontrak(no_kontrak);
	        		
		          	  
	            	
	            	
	            }
	        }); 
		    
		    
		    
		    
		    return gridpasokan;   
	  }
	  
	  private Grid<BeanModelMasterBb> createGrid() {  
	    
		  final List<ColumnConfig> columns = new ArrayList<ColumnConfig>(); 
		    
		    store1 = new ListStore<BeanModelMasterBb>();
			
			getdataKit(); 
			
			RowNumberer id = new RowNumberer();  
		    id.setWidth(30);
		    
		    ColumnConfig nmkit = new ColumnConfig("nama_pembangkit", "Nama Pembangkit", 250);
		    nmkit.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig nmpic = new ColumnConfig("nama_pic", "Nama PIC", 120);
		    nmpic.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig alamat = new ColumnConfig("alamat", "Alamat", 100);
		    alamat.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig pemilik = new ColumnConfig("kepemilikan", "Pemilik", 100);
		    pemilik.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig wilayah = new ColumnConfig("wilayah", "Wilayah", 130);
		    wilayah.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig jeniskit = new ColumnConfig("jenis_pembangkit", "Jenis Pembangkit", 130);
		    jeniskit.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig tlp = new ColumnConfig("telp", "Telp", 130);
		    tlp.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig daya = new ColumnConfig("daya_terpasang", "Daya Terpasang", 130);
		    daya.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig sfc = new ColumnConfig("sfc", "SFC", 130);
		    sfc.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig capacity_F = new ColumnConfig("capacity_factor", "Capacity Factor", 130);
		    capacity_F.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig hear_rate = new ColumnConfig("heat_rate", "Heat Rate", 130);
		    hear_rate.setAlignment(HorizontalAlignment.LEFT);
		    
		    columns.add(nmkit);
		    columns.add(jeniskit);
		    columns.add(daya);
		    columns.add(pemilik);
		    columns.add(alamat);
		    columns.add(wilayah);
		    columns.add(nmpic);
		    columns.add(sfc);
		    columns.add(capacity_F);
		    columns.add(hear_rate); 
		  
		    final ColumnModel cm = new ColumnModel(columns);
		    
		    grid = new Grid<BeanModelMasterBb>(store1, cm);
		    grid.setBorders(true); 
	    
	    return grid;  
	  }  
	  
	  private Grid<BeanModelMasterBb> createGridVirtualPembangkit() {  
		    
		  	final List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
	  		CheckBoxSelectionModel<BeanModelMasterBb> sm = new CheckBoxSelectionModel<BeanModelMasterBb>();
			columns.add(sm.getColumn());
		    
		    storeVirtualPembangkit = new ListStore<BeanModelMasterBb>();
			
		    getdataKitVirtualPembangkit(); 
			
			RowNumberer id = new RowNumberer();  
		    id.setWidth(30);
		    
		    ColumnConfig nmkit = new ColumnConfig("nama_pembangkit", "Nama Pembangkit", 250);
		    nmkit.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig nmpic = new ColumnConfig("nama_pic", "Nama PIC", 120);
		    nmpic.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig alamat = new ColumnConfig("alamat", "Alamat", 100);
		    alamat.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig pemilik = new ColumnConfig("kepemilikan", "Pemilik", 100);
		    pemilik.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig wilayah = new ColumnConfig("wilayah", "Wilayah", 130);
		    wilayah.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig jeniskit = new ColumnConfig("jenis_pembangkit", "Jenis Pembangkit", 130);
		    jeniskit.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig tlp = new ColumnConfig("telp", "Telp", 130);
		    tlp.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig daya = new ColumnConfig("daya_terpasang", "Daya Terpasang", 130);
		    daya.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig sfc = new ColumnConfig("sfc", "SFC", 130);
		    sfc.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig capacity_F = new ColumnConfig("capacity_factor", "Capacity Factor", 130);
		    capacity_F.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig hear_rate = new ColumnConfig("heat_rate", "Heat Rate", 130);
		    hear_rate.setAlignment(HorizontalAlignment.LEFT);
		    
		    columns.add(nmkit);
		    columns.add(jeniskit);
		    columns.add(daya);
		    columns.add(pemilik);
		    columns.add(alamat);
		    columns.add(wilayah);
		    columns.add(nmpic);
		    columns.add(sfc);
		    columns.add(capacity_F);
		    columns.add(hear_rate); 
		  
		    final ColumnModel cm = new ColumnModel(columns);
		    
		    gridVirtualPembangkit = new Grid<BeanModelMasterBb>(storeVirtualPembangkit, cm);
		    gridVirtualPembangkit.setBorders(true); 
	    
	    return gridVirtualPembangkit;  
	  }
	  
	  private Grid<BeanModelMasterBb> createGrid1() {  
		    
		  store2 = new ListStore<BeanModelMasterBb>();
		    getdataPemasok();
		  
		    RowNumberer rn = new RowNumberer();  
		    rn.setWidth(30);
		    
		    id_pemasok.setId("id_pemasok");
		    id_pemasok.setHeader("id pemasok");
		    id_pemasok.setWidth(150);
		    id_pemasok.setAlignment(HorizontalAlignment.LEFT);
		    id_pemasok.setHidden(true);
		    
		    pemasok.setId("pemasok");
		    pemasok.setHeader("Pemasok");
		    pemasok.setWidth(150);
		    pemasok.setAlignment(HorizontalAlignment.LEFT);
		    
		    alamat.setId("alamat");
		    alamat.setHeader("Alamat");
		    alamat.setWidth(150);
		    alamat.setAlignment(HorizontalAlignment.LEFT);
		    
		    pic_presdir.setId("pic_presdir");
		    pic_presdir.setHeader("PIC Pres Dir");
		    pic_presdir.setWidth(150);
		    pic_presdir.setAlignment(HorizontalAlignment.LEFT);
		    
		    pic_dir_marketing.setId("pic_dir_marketing");
		    pic_dir_marketing.setHeader("PIC Dir Marketing");
		    pic_dir_marketing.setWidth(150);
		    pic_dir_marketing.setAlignment(HorizontalAlignment.LEFT);

		    pic_man_opr.setId("pic_man_opr");
		    pic_man_opr.setHeader("PIC Mgr Operasi");
		    pic_man_opr.setWidth(150);
		    pic_man_opr.setAlignment(HorizontalAlignment.LEFT);
		    
		    status_pemasok.setId("status_pemasok");
		    status_pemasok.setHeader("Status Pemasok");
		    status_pemasok.setWidth(150);
		    status_pemasok.setAlignment(HorizontalAlignment.LEFT);
		    
		    nama_tambang.setId("nama_tambang");
		    nama_tambang.setHeader("Nama Tambang");
		    nama_tambang.setWidth(150);
		    nama_tambang.setAlignment(HorizontalAlignment.LEFT);
		    
		    produksi.setId("produksi");
		    produksi.setHeader("Produksi");
		    produksi.setWidth(150);
		    produksi.setAlignment(HorizontalAlignment.LEFT);
		    
		    loading_port.setId("loading_port");
		    loading_port.setHeader("Loading Port");
		    loading_port.setWidth(150);
		    loading_port.setAlignment(HorizontalAlignment.LEFT);
		    
		    fasilitas_loading.setId("fasilitas_loading");
		    fasilitas_loading.setHeader("Fasilitas Loading");
		    fasilitas_loading.setWidth(150);
		    fasilitas_loading.setAlignment(HorizontalAlignment.LEFT);
		    
		    jarak_hauling.setId("jarak_hauling");
		    jarak_hauling.setHeader("Jarak Hauling");
		    jarak_hauling.setWidth(150);
		    jarak_hauling.setAlignment(HorizontalAlignment.LEFT);
		    
		    flag_blacklist.setId("flag_blacklist");
		    flag_blacklist.setHeader("Flag Blacklist");
		    flag_blacklist.setWidth(150);
		    flag_blacklist.setAlignment(HorizontalAlignment.LEFT);
		    
		    status_aktif.setId("status_aktif");
		    status_aktif.setHeader("Status Aktif");
		    status_aktif.setWidth(150);
		    status_aktif.setAlignment(HorizontalAlignment.LEFT);
		    
		    keterangan.setId("keterangan");
		    keterangan.setHeader("Keterangan");
		    keterangan.setWidth(150);
		    keterangan.setAlignment(HorizontalAlignment.LEFT);
			
			
			columns.add(rn);
			columns.add(id_pemasok);
			columns.add(pemasok);
			columns.add(alamat);
			columns.add(pic_presdir);
			columns.add(pic_dir_marketing);
			columns.add(pic_man_opr);
			columns.add(status_pemasok);
			columns.add(nama_tambang);
			columns.add(produksi);
			columns.add(loading_port);
			columns.add(fasilitas_loading);
			columns.add(jarak_hauling);
			columns.add(flag_blacklist);
			columns.add(status_aktif);
			columns.add(keterangan);
		  
		    final ColumnModel cm = new ColumnModel(columns);
		    
		    grid1 = new Grid<BeanModelMasterBb>(store2, cm);
		    grid1.setBorders(true);  
		    
		    return grid1;  
		  }  
	  
	  	private Grid<BeanModelMasterBb> createGridVirtualPemasok() {  
	  		
	  		final List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
	  		CheckBoxSelectionModel<BeanModelMasterBb> sm = new CheckBoxSelectionModel<BeanModelMasterBb>();
			columns.add(sm.getColumn());
	  		
	  		storeVirtualPemasok = new ListStore<BeanModelMasterBb>();
		    getdataPemasokVirtualPemasok();
		  
		    RowNumberer rn = new RowNumberer();  
		    rn.setWidth(30);
		    
		    ColumnConfig nmkit = new ColumnConfig("nama_pembangkit", "Nama Pembangkit", 250);
		    nmkit.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig nmpic = new ColumnConfig("nama_pic", "Nama PIC", 120);
		    nmpic.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig alamat = new ColumnConfig("alamat", "Alamat", 100);
		    alamat.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig pemilik = new ColumnConfig("kepemilikan", "Pemilik", 100);
		    pemilik.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig wilayah = new ColumnConfig("wilayah", "Wilayah", 130);
		    wilayah.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig jeniskit = new ColumnConfig("jenis_pembangkit", "Jenis Pembangkit", 130);
		    jeniskit.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig tlp = new ColumnConfig("telp", "Telp", 130);
		    tlp.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig daya = new ColumnConfig("daya_terpasang", "Daya Terpasang", 130);
		    daya.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig sfc = new ColumnConfig("sfc", "SFC", 130);
		    sfc.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig capacity_F = new ColumnConfig("capacity_factor", "Capacity Factor", 130);
		    capacity_F.setAlignment(HorizontalAlignment.LEFT);
		    
		    ColumnConfig hear_rate = new ColumnConfig("heat_rate", "Heat Rate", 130);
		    hear_rate.setAlignment(HorizontalAlignment.LEFT);
			
			
//			columns.add(rn);
			columns.add(id_pemasok);
			columns.add(pemasok);
			columns.add(alamat);
			columns.add(pic_presdir);
			columns.add(pic_dir_marketing);
			columns.add(pic_man_opr);
			columns.add(status_pemasok);
			columns.add(nama_tambang);
			columns.add(produksi);
			columns.add(loading_port);
			columns.add(fasilitas_loading);
			columns.add(jarak_hauling);
			columns.add(flag_blacklist);
			columns.add(status_aktif);
			columns.add(keterangan);
		  
		    final ColumnModel cm = new ColumnModel(columns);
		    
		    gridVirtualPemasok = new Grid<BeanModelMasterBb>(storeVirtualPemasok, cm);
		    gridVirtualPemasok.setBorders(true);  
		    
		    return gridVirtualPemasok;  
		  }  
	  
	  private void getdataKit() {
		  GWT.log("MASUK DATA GET DATA Kit",null);
		  datakit = new ArrayList<BeanModelMasterBb>();
		  	rkapService.getListMasterBb("KIT", new AsyncCallback<List<BeanModelMasterBb>>() {
						public void onFailure(Throwable caught) {
							GWT.log(caught.getMessage(), null);
						}

						public void onSuccess(List<BeanModelMasterBb> result) {
//							GWT.log("ep total : " + result.size(),null);
//							System.out.println("ep total : " + result.size());
							for (int i = 0; i < result.size(); i++) {
								datakit.add(new BeanModelMasterBb(
										result.get(i).getId_pltu(),
										result.get(i).getNama_pembangkit(),
										result.get(i).getNama_pic(),
										result.get(i).getAlamat(),
										result.get(i).getKepemilikan(),
										result.get(i).getLatitude(),
										result.get(i).getLongitude(),
										result.get(i).getWilayah(),
										result.get(i).getJenis_pembangkit(),
										result.get(i).getTelp(),
										result.get(i).getDaya_terpasang(),
										result.get(i).getSfc(),
										result.get(i).getCapacity_factor(),
										result.get(i).getHeat_rate(),
										result.get(i).getCreateby(),
										result.get(i).getCreatedate(),
										result.get(i).getUpdateby(),
										result.get(i).getUpdatedate(),
										result.get(i).getApp_access()));
							}
							store1.add(datakit);
							grid.unmask();
							GWT.log("grid Kit : " + datakit.size(), null);
							
						}
					});

	}
	  
	  private void getdataKitVirtualPembangkit() {
		  GWT.log("MASUK DATA GET DATA Kit",null);
		  datakit = new ArrayList<BeanModelMasterBb>();
		  	rkapService.getListMasterBb("KIT", new AsyncCallback<List<BeanModelMasterBb>>() {
						public void onFailure(Throwable caught) {
							GWT.log(caught.getMessage(), null);
						}

						public void onSuccess(List<BeanModelMasterBb> result) {
//							GWT.log("ep total : " + result.size(),null);
//							System.out.println("ep total : " + result.size());
							for (int i = 0; i < result.size(); i++) {
								datakit.add(new BeanModelMasterBb(
										result.get(i).getId_pltu(),
										result.get(i).getNama_pembangkit(),
										result.get(i).getNama_pic(),
										result.get(i).getAlamat(),
										result.get(i).getKepemilikan(),
										result.get(i).getLatitude(),
										result.get(i).getLongitude(),
										result.get(i).getWilayah(),
										result.get(i).getJenis_pembangkit(),
										result.get(i).getTelp(),
										result.get(i).getDaya_terpasang(),
										result.get(i).getSfc(),
										result.get(i).getCapacity_factor(),
										result.get(i).getHeat_rate(),
										result.get(i).getCreateby(),
										result.get(i).getCreatedate(),
										result.get(i).getUpdateby(),
										result.get(i).getUpdatedate(),
										result.get(i).getApp_access()));
							}
							storeVirtualPembangkit.add(datakit);
							gridVirtualPembangkit.unmask();
							GWT.log("grid Kit : " + datakit.size(), null);
							
						}
					});

	}
	  
	  private void getdataPemasok() {
		  GWT.log("MASUK DATA GET DATA Pemasok",null);
		  datapemasok = new ArrayList<BeanModelMasterBb>();
		  	rkapService.getListMasterBb("PEMASOK", new AsyncCallback<List<BeanModelMasterBb>>() {
						public void onFailure(Throwable caught) {
							GWT.log(caught.getMessage(), null);
						}

						public void onSuccess(List<BeanModelMasterBb> result) {
//							GWT.log("ep total : " + result.size(),null);
//							System.out.println("ep total : " + result.size());
							for (int i = 0; i < result.size(); i++) {
								datapemasok.add(new BeanModelMasterBb(
										result.get(i).getId_pemasok(),
										result.get(i).getPemasok(),
										result.get(i).getAlamat(),
										result.get(i).getPic_presdir(),
										result.get(i).getPic_presdir_hp(),
										result.get(i).getPic_dir_marketing(),
										result.get(i).getPic_dir_marketing_hp(),
										result.get(i).getPic_man_opr(),
										result.get(i).getPic_man_opr_hp(),
										result.get(i).getStatus_pemasok(),
										result.get(i).getNama_tambang(),
										result.get(i).getProduksi(),
										result.get(i).getLoading_port(),
										result.get(i).getFasilitas_loading(),
										result.get(i).getJarak_hauling(),
										result.get(i).getFlag_blacklist(),
										result.get(i).getStatus_aktif(),
										result.get(i).getKeterangan(),
										result.get(i).getCreateby(),
										result.get(i).getCreatedate(),
										result.get(i).getUpdateby(),
										result.get(i).getUpdatedate(),
										result.get(i).getApp_access(),
										result.get(i).getId_pusat(),
										result.get(i).getStatus(),
										result.get(i).getTelp(),
										result.get(i).getFax(),
										result.get(i).getEmail()));
							}
							store2.add(datapemasok);
							grid1.unmask();
							GWT.log("grid Pemasok : " + datapemasok.size(), null);
							
						}
					});

	}
	  
	  private void getdataPemasokVirtualPemasok() {
		  GWT.log("MASUK DATA GET DATA Pemasok",null);
		  datapemasok = new ArrayList<BeanModelMasterBb>();
		  	rkapService.getListMasterBb("PEMASOK", new AsyncCallback<List<BeanModelMasterBb>>() {
						public void onFailure(Throwable caught) {
							GWT.log(caught.getMessage(), null);
						}

						public void onSuccess(List<BeanModelMasterBb> result) {
//							GWT.log("ep total : " + result.size(),null);
//							System.out.println("ep total : " + result.size());
							for (int i = 0; i < result.size(); i++) {
								datapemasok.add(new BeanModelMasterBb(
										result.get(i).getId_pemasok(),
										result.get(i).getPemasok(),
										result.get(i).getAlamat(),
										result.get(i).getPic_presdir(),
										result.get(i).getPic_presdir_hp(),
										result.get(i).getPic_dir_marketing(),
										result.get(i).getPic_dir_marketing_hp(),
										result.get(i).getPic_man_opr(),
										result.get(i).getPic_man_opr_hp(),
										result.get(i).getStatus_pemasok(),
										result.get(i).getNama_tambang(),
										result.get(i).getProduksi(),
										result.get(i).getLoading_port(),
										result.get(i).getFasilitas_loading(),
										result.get(i).getJarak_hauling(),
										result.get(i).getFlag_blacklist(),
										result.get(i).getStatus_aktif(),
										result.get(i).getKeterangan(),
										result.get(i).getCreateby(),
										result.get(i).getCreatedate(),
										result.get(i).getUpdateby(),
										result.get(i).getUpdatedate(),
										result.get(i).getApp_access(),
										result.get(i).getId_pusat(),
										result.get(i).getStatus(),
										result.get(i).getTelp(),
										result.get(i).getFax(),
										result.get(i).getEmail()));
							}
							storeVirtualPemasok.add(datapemasok);
							gridVirtualPemasok.unmask();
							GWT.log("grid Pemasok : " + datapemasok.size(), null);
							
						}
					});

	}
	  
	  private void getdataSurveyor() {
		  GWT.log("MASUK DATA GET DATA Surveyor",null);
		  datasurveyor = new ArrayList<BeanModelMasterBb>();
		  	rkapService.getListMasterBb("SURVEYOR", new AsyncCallback<List<BeanModelMasterBb>>() {
						public void onFailure(Throwable caught) {
							GWT.log(caught.getMessage(), null);
						}

						public void onSuccess(List<BeanModelMasterBb> result) {
//							GWT.log("ep total : " + result.size(),null);
//							System.out.println("ep total : " + result.size());
							for (int i = 0; i < result.size(); i++) {
								System.out.println("nm surveyor ui: " + result.get(i).getNama_surveyor());
								datasurveyor.add(new BeanModelMasterBb(
										result.get(i).getId_surveyor(),
										result.get(i).getNama_surveyor(),
										result.get(i).getNo_kerjasama(),
										result.get(i).getTanggal(),
										result.get(i).getTelp(),
										result.get(i).getAlamat(),
										result.get(i).getPic(),
										result.get(i).getKeterangan(),
										result.get(i).getNo_kontrak(),
										result.get(i).getCreateby(),
										result.get(i).getCreatedate(),
										result.get(i).getUpdateby(),
										result.get(i).getUpdatedate(),
										result.get(i).getApp_access()));
							}
							store3.add(datasurveyor);
							gridpasokan.unmask();
							GWT.log("grid Surveyor : " + datasurveyor.size(), null);
							
						}
					});

	}
	  
	  public Grid<BeanModelMasterBb> VirtualPembangkit(){
		  	gridVirtualPembangkit = createGridVirtualPembangkit();
  	  		ContentPanel pan1 = new ContentPanel();
  	  	
  	  		pan1.setButtonAlign(HorizontalAlignment.LEFT);  
  	  		pan1.addButton(new Button("Cancel", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {  
		    	gridVirtualPembangkit.getStore().rejectChanges(); 
		        window.close();
		      }  
		    }));  
  	  		pan1.addButton(new Button("Save", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {
		    	  
		    	  	gridVirtualPembangkit.getStore().commitChanges();
			        Info.display("Notifikasi: ", "Data Berhasil Di Simpan");
			        window.close();
			      }  
		    }));  
		    
  	  		pan1.setButtonAlign(HorizontalAlignment.CENTER);
  	  	
	    	pan1.setHeaderVisible(false);
	  	    pan1.setLayout(new FitLayout());
	  	    pan1.setHeight(300);
	  	    pan1.setWidth(600);
	  	    pan1.add(gridVirtualPembangkit);
  	  
//	  	    window = new Window();  
//		    window.setHeading("New GRID Pembangkit"); 
//		    window.setLayout(new FitLayout());
//		    window.setAutoHeight(true);
//		    window.setWidth(600);
//		    window.setScrollMode(Scroll.AUTO);
//		    window.add(pan1);
//		    
//		    window.show();
		    
		    return gridVirtualPembangkit;
	  }
	  
	  public Grid<BeanModelMasterBb> VirtualPemasok(){
		  	gridVirtualPemasok = createGridVirtualPemasok();
	  		ContentPanel pan1 = new ContentPanel();
	  	
	  		pan1.setButtonAlign(HorizontalAlignment.LEFT);  
	  		pan1.addButton(new Button("Cancel", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {  
		    	gridVirtualPemasok.getStore().rejectChanges(); 
		        window.close();
		      }  
		    }));  
	  		pan1.addButton(new Button("Save", new SelectionListener<ButtonEvent>() {  
		      @Override  
		      public void componentSelected(ButtonEvent ce) {
		    	  
		    	  gridVirtualPemasok.getStore().commitChanges();
			        Info.display("Notifikasi: ", "Data Berhasil Di Simpan");
			        window.close();
			      }  
		    }));  
		    
	  		pan1.setButtonAlign(HorizontalAlignment.CENTER);
	  	
	    	pan1.setHeaderVisible(false);
	  	    pan1.setLayout(new FitLayout());
	  	    pan1.setHeight(300);
	  	    pan1.setWidth(600);
	  	    pan1.add(gridVirtualPemasok);
	  
//	  	    window = new Window();  
//		    window.setHeading("New GRID Pemasok"); 
//		    window.setLayout(new FitLayout());
//		    window.setAutoHeight(true);
//		    window.setWidth(600);
//		    window.setScrollMode(Scroll.AUTO);
//		    window.add(pan1);
//		    
//		    window.show();
		    
		    return gridVirtualPemasok;
	  }
	  
	  
}